//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Data;
using OpenLS.Drawing;

namespace OpenLS.Chart.UI
{
    class EnsureShapePropertiesConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                return null;
            if (value is IShape)
            {
                var l = (IShape) value;
                if (l.ShapeProperties == null)
                    l.ShapeProperties = new ShapeProperties();
                return l.ShapeProperties;
            }
            throw new NotSupportedException();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
